home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 021-030 / amok24 / dme / src / source.zoo / initdeemunw.c < prev    next >
Text File  |  1989-07-03  |  1KB  |  52 lines

  1.  
  2. /*
  3.  *  DEEMU NW structure auto init.
  4.  *
  5.  *  Intuition must be openned.
  6.  */
  7.  
  8. /*
  9.  *  Fixed bug with Width == 0
  10.  */
  11.  
  12. typedef struct NewWindow NW;
  13. typedef struct Screen    SCR;
  14.  
  15. InitDeemuNW(ary, nw)
  16. register short *ary;
  17. register NW *nw;
  18. {
  19.     register short alen = ary[3];
  20.     SCR Scr;
  21.  
  22.     if (GetScreenData(&Scr, sizeof(Scr), nw->Type, nw->Screen) == 0) {
  23.         Scr.Width = 320;
  24.         Scr.Height= 200;
  25.     }
  26.     if (alen >= 8) {
  27.         if ((nw->Width   = ary[6]) <= 0)
  28.             nw->Width += Scr.Width;
  29.         if ((nw->Height  = ary[7]) <= 0)
  30.             nw->Height+= Scr.Height;
  31.     }
  32.     if (alen >= 4) {
  33.         if ((nw->LeftEdge= ary[4]) < 0)
  34.             nw->LeftEdge += Scr.Width - nw->Width;
  35.         if ((nw->TopEdge = ary[5]) < 0)
  36.             nw->TopEdge += Scr.Height - nw->Height;
  37.     }
  38.     if (nw->LeftEdge < 0 || nw->TopEdge < 0 || nw->Width < 0 || nw->Height < 0 ||
  39.         nw->LeftEdge + nw->Width > Scr.Width || nw->TopEdge + nw->Height > Scr.Height) {
  40.  
  41.         nw->LeftEdge = nw->TopEdge = 0;
  42.         nw->Width = 320;
  43.         nw->Height= 100;
  44.     }
  45.     if (alen >= 9)
  46.         nw->DetailPen = ary[8] >> 8;
  47.     if (alen >= 10)
  48.         nw->BlockPen  = ary[8];
  49. }
  50.  
  51.  
  52.